package com.liuya.safe.entitle.controller;

import com.liuya.safe.entitle.service.PrivilegeManagerService;
import com.liuya.safe.util.Factory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Collection;

/**
 * 导出权限常量
 */
@Controller
@RequestMapping("/privilegeExport")
public class PrivilegeExportController {

    @RequestMapping("/export")
    public String export(HttpServletRequest req, HttpServletResponse rep, ModelMap map) {
        PrivilegeManagerService pvlgMng = Factory.getPrivilegeManager("");

        Collection businessPrivileges = pvlgMng.getAllBusinessPrivileges();
        Collection nonRolePrivileges = pvlgMng.getAllNonRolePrivileges();

        req.setAttribute("businessPrivileges", businessPrivileges);
        req.setAttribute("nonRolePrivileges", nonRolePrivileges);

        return "privilege/constants";
    }

}
